package cn.sccl.dirms.sms;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.jms.Message;
import javax.jms.MessageListener;

/**
 *  自动处理发送sms
 * Created by xf-cl on 2017/11/22.15:29
 */
@Component
public class QueueMessageListener implements MessageListener {
    private static Logger log = LoggerFactory.getLogger(QueueMessageListener.class);

    @Autowired
    private ConsumerService consumerService;
    @Override
    public void onMessage(Message message) {
        log.debug("activemq收到消息，将消息发送给消费方");
        try {
            consumerService.comsumerSms(message);
        } catch (Exception e) {
            log.error("异常：",e);
        }
    }
}
